package com.example.adopt.config;

import javax.servlet.http.HttpSession;

public class Session {
    /**
     * Description : 从session中获取用户uid
     * @param session springboot启动时生成的session对象
     * @return java.lang.Integer
     **/
    public final Integer getUserIdFromSession(HttpSession session){
        String uidStr = session.getAttribute("uid").toString();
        return Integer.valueOf(uidStr);
    }

    /**
     * Description : 从session中获取用户username
     * @param session springboot启动时生成的session对象
     * @return java.lang.String
     **/
    public final String getUsernameFromSession(HttpSession session){
        return session.getAttribute("username").toString();
    }
}
